package com.SmartCare.controller.manager;


import com.SmartCare.common.Result;
import com.SmartCare.pojo.message.MsgBindElder;
import com.SmartCare.service.message.MsgBindElderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 绑定老人消息表 前端控制器
 */
@RestController
@RequestMapping("/msg-bind-elder")
public class MsgBindElderController {
    @Resource
    private MsgBindElderService msgBindElderService;

    //根据养老院名获取消息列表
    @GetMapping("/query-by-name")
    public Result queryByName(@RequestParam String name){
        return msgBindElderService.query(name);
    }

    @PutMapping("/update")
    public Result update(@RequestBody MsgBindElder msg) {
        return msgBindElderService.updateMsg(msg);
    }

    @PostMapping("/send-request")
    public Result sendRequest(@RequestParam String careHomeName, @RequestParam Long userId, @RequestParam Long elderId) {
        return msgBindElderService.addNewMsg(careHomeName, userId, elderId);
    }
}

